package com.itheima.service.impl;

import cn.hutool.core.util.ArrayUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.itheima.domain.ProductVertifyRecord;
import com.itheima.mapper.ProductVertifyRecordMapper;
import com.itheima.service.IProductVertifyRecordService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 商品审核记录 服务实现类
 * </p>
 *
 * @author fukeke
 * @since 2022-11-11
 */
@DubboService
public class ProductVertifyRecordServiceImpl extends ServiceImpl<ProductVertifyRecordMapper, ProductVertifyRecord> implements IProductVertifyRecordService {
    @Autowired
    ProductVertifyRecordMapper productVertifyRecordMapper;

    @Override
    public void verify(Integer[] ids, Integer verifyStatus, String detail) {
        if(ArrayUtil.isNotEmpty(ids))
        {
            for (Integer id : ids) {
                ProductVertifyRecord productVertifyRecord = productVertifyRecordMapper.selectById(id);
                productVertifyRecord.setDetail(detail);
                productVertifyRecord.setStatus(verifyStatus);
                productVertifyRecordMapper.updateById(productVertifyRecord);

            }
        }
    }
}
